package com.nondo.dean.order.mapper;

import com.nondo.dean.common.mybatis.Table;
import com.nondo.dean.order.domain.OrderDetail;
import com.nondo.dean.order.domain.OrderDetailExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

@Table("order_detail")
@Mapper
public interface OrderDetailMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @SelectProvider(type=OrderDetailSqlProvider.class, method="countByExample")
    long countByExample(OrderDetailExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @DeleteProvider(type=OrderDetailSqlProvider.class, method="deleteByExample")
    int deleteByExample(OrderDetailExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @Delete({
        "delete from order_detail",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @Insert({
        "insert into order_detail (order_code, product_id, ",
        "product_code, product_name, ",
        "product_image, product_unit, ",
        "product_price_grade, product_price, ",
        "purchase_quantity, amount, ",
        "special_price, po_item, ",
        "order_id, up_id, bom_quantity, ",
        "software_flag, business_code, ",
        "note, create_by, create_date, ",
        "update_by, update_date, ",
        "remarks, del_flag)",
        "values (#{orderCode,jdbcType=VARCHAR}, #{productId,jdbcType=INTEGER}, ",
        "#{productCode,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR}, ",
        "#{productImage,jdbcType=VARCHAR}, #{productUnit,jdbcType=VARCHAR}, ",
        "#{productPriceGrade,jdbcType=INTEGER}, #{productPrice,jdbcType=DECIMAL}, ",
        "#{purchaseQuantity,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, ",
        "#{specialPrice,jdbcType=DECIMAL}, #{poItem,jdbcType=VARCHAR}, ",
        "#{orderId,jdbcType=INTEGER}, #{upId,jdbcType=INTEGER}, #{bomQuantity,jdbcType=INTEGER}, ",
        "#{softwareFlag,jdbcType=VARCHAR}, #{businessCode,jdbcType=VARCHAR}, ",
        "#{note,jdbcType=VARCHAR}, #{createBy,jdbcType=BIGINT}, #{createDate,jdbcType=TIMESTAMP}, ",
        "#{updateBy,jdbcType=BIGINT}, #{updateDate,jdbcType=TIMESTAMP}, ",
        "#{remarks,jdbcType=VARCHAR}, #{delFlag,jdbcType=CHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(OrderDetail record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @InsertProvider(type=OrderDetailSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insertSelective(OrderDetail record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @SelectProvider(type=OrderDetailSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="order_code", property="orderCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_id", property="productId", jdbcType=JdbcType.INTEGER),
        @Result(column="product_code", property="productCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_name", property="productName", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_image", property="productImage", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_unit", property="productUnit", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_price_grade", property="productPriceGrade", jdbcType=JdbcType.INTEGER),
        @Result(column="product_price", property="productPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="purchase_quantity", property="purchaseQuantity", jdbcType=JdbcType.INTEGER),
        @Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
        @Result(column="special_price", property="specialPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="po_item", property="poItem", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
        @Result(column="up_id", property="upId", jdbcType=JdbcType.INTEGER),
        @Result(column="bom_quantity", property="bomQuantity", jdbcType=JdbcType.INTEGER),
        @Result(column="software_flag", property="softwareFlag", jdbcType=JdbcType.VARCHAR),
        @Result(column="business_code", property="businessCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="note", property="note", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_by", property="createBy", jdbcType=JdbcType.BIGINT),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_by", property="updateBy", jdbcType=JdbcType.BIGINT),
        @Result(column="update_date", property="updateDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR),
        @Result(column="del_flag", property="delFlag", jdbcType=JdbcType.CHAR)
    })
    List<OrderDetail> selectByExampleWithRowbounds(OrderDetailExample example, RowBounds rowBounds);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @SelectProvider(type=OrderDetailSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="order_code", property="orderCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_id", property="productId", jdbcType=JdbcType.INTEGER),
        @Result(column="product_code", property="productCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_name", property="productName", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_image", property="productImage", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_unit", property="productUnit", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_price_grade", property="productPriceGrade", jdbcType=JdbcType.INTEGER),
        @Result(column="product_price", property="productPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="purchase_quantity", property="purchaseQuantity", jdbcType=JdbcType.INTEGER),
        @Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
        @Result(column="special_price", property="specialPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="po_item", property="poItem", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
        @Result(column="up_id", property="upId", jdbcType=JdbcType.INTEGER),
        @Result(column="bom_quantity", property="bomQuantity", jdbcType=JdbcType.INTEGER),
        @Result(column="software_flag", property="softwareFlag", jdbcType=JdbcType.VARCHAR),
        @Result(column="business_code", property="businessCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="note", property="note", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_by", property="createBy", jdbcType=JdbcType.BIGINT),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_by", property="updateBy", jdbcType=JdbcType.BIGINT),
        @Result(column="update_date", property="updateDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR),
        @Result(column="del_flag", property="delFlag", jdbcType=JdbcType.CHAR)
    })
    List<OrderDetail> selectByExample(OrderDetailExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @Select({
        "select",
        "id, order_code, product_id, product_code, product_name, product_image, product_unit, ",
        "product_price_grade, product_price, purchase_quantity, amount, special_price, ",
        "po_item, order_id, up_id, bom_quantity, software_flag, business_code, note, ",
        "create_by, create_date, update_by, update_date, remarks, del_flag",
        "from order_detail",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="order_code", property="orderCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_id", property="productId", jdbcType=JdbcType.INTEGER),
        @Result(column="product_code", property="productCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_name", property="productName", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_image", property="productImage", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_unit", property="productUnit", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_price_grade", property="productPriceGrade", jdbcType=JdbcType.INTEGER),
        @Result(column="product_price", property="productPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="purchase_quantity", property="purchaseQuantity", jdbcType=JdbcType.INTEGER),
        @Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
        @Result(column="special_price", property="specialPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="po_item", property="poItem", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
        @Result(column="up_id", property="upId", jdbcType=JdbcType.INTEGER),
        @Result(column="bom_quantity", property="bomQuantity", jdbcType=JdbcType.INTEGER),
        @Result(column="software_flag", property="softwareFlag", jdbcType=JdbcType.VARCHAR),
        @Result(column="business_code", property="businessCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="note", property="note", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_by", property="createBy", jdbcType=JdbcType.BIGINT),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_by", property="updateBy", jdbcType=JdbcType.BIGINT),
        @Result(column="update_date", property="updateDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR),
        @Result(column="del_flag", property="delFlag", jdbcType=JdbcType.CHAR)
    })
    OrderDetail selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @UpdateProvider(type=OrderDetailSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") OrderDetail record, @Param("example") OrderDetailExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @UpdateProvider(type=OrderDetailSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") OrderDetail record, @Param("example") OrderDetailExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @UpdateProvider(type=OrderDetailSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(OrderDetail record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_detail
     *
     * @mbg.generated Thu May 31 17:31:51 CST 2018
     */
    @Update({
        "update order_detail",
        "set order_code = #{orderCode,jdbcType=VARCHAR},",
          "product_id = #{productId,jdbcType=INTEGER},",
          "product_code = #{productCode,jdbcType=VARCHAR},",
          "product_name = #{productName,jdbcType=VARCHAR},",
          "product_image = #{productImage,jdbcType=VARCHAR},",
          "product_unit = #{productUnit,jdbcType=VARCHAR},",
          "product_price_grade = #{productPriceGrade,jdbcType=INTEGER},",
          "product_price = #{productPrice,jdbcType=DECIMAL},",
          "purchase_quantity = #{purchaseQuantity,jdbcType=INTEGER},",
          "amount = #{amount,jdbcType=DECIMAL},",
          "special_price = #{specialPrice,jdbcType=DECIMAL},",
          "po_item = #{poItem,jdbcType=VARCHAR},",
          "order_id = #{orderId,jdbcType=INTEGER},",
          "up_id = #{upId,jdbcType=INTEGER},",
          "bom_quantity = #{bomQuantity,jdbcType=INTEGER},",
          "software_flag = #{softwareFlag,jdbcType=VARCHAR},",
          "business_code = #{businessCode,jdbcType=VARCHAR},",
          "note = #{note,jdbcType=VARCHAR},",
          "create_by = #{createBy,jdbcType=BIGINT},",
          "create_date = #{createDate,jdbcType=TIMESTAMP},",
          "update_by = #{updateBy,jdbcType=BIGINT},",
          "update_date = #{updateDate,jdbcType=TIMESTAMP},",
          "remarks = #{remarks,jdbcType=VARCHAR},",
          "del_flag = #{delFlag,jdbcType=CHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(OrderDetail record);
}